# pip install rpa

# import rpa as r

# r.init()
# r.url('https://duckduckgo.com')
# r.type('//*[@name="q"]', 'decentralisation[enter]')
# r.wait() # ensure results are fully loaded
# r.snap('page', 'results.png')
# r.close()


from pywinauto import Application

# 启动 IE 浏览器
app = Application(backend="uia").start("C:\Program Files\Internet Explorer\iexplore.exe")

# 连接到 IE 浏览器窗口
ie_window = app.window(title_re=".*Internet Explorer.*")

# 访问网页
ie_window.type_keys("https://www.baidu.com")  # 替换为您要访问的网址

# 执行 JavaScript 脚本
ie_window.execute_script("alert('Hello from JavaScript!');")